<script type="text/javascript"><!--//--><![CDATA[//><!--

    var grid_reload = function() {
        $('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
    };
    
    $(document).ready(function() {
       // Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			//singleSelect:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center', rowspan:2},				
				{ field : 'no_tenant', title : 'No Tenant', width:100, sortable:true, rowspan:2},
				{ field : 'nama_tenant', title : 'Nama Tenant', width:200, sortable:true, rowspan:2},
				{ field : 'no_toko', title : 'No Toko', width:100, sortable:true, rowspan:2},
				{ field : 'jenis_usaha', title : 'Jenis Usaha', width:170, sortable:true, rowspan:2},
				{ field : 'lokasi_tempat', title : 'Lokasi Tempat', width:170, sortable:true, rowspan:2},
				{ field : 'luas_tempat', title : 'Luas Tempat', width:150, sortable:true, rowspan:2},
				{ field : 'alamat_lengkap', title : 'Alamat Rumah/Kantor', width:250, sortable:true, rowspan:2},
				{ field : 'status_anggota', title : 'Status Anggota', width:100, sortable:true, rowspan:2},
				{ field : 'no_telephone', title : 'No Telephone', width:150, sortable:true, rowspan:2},
				{ field : 'no_handphone', title : 'No Handphone', width:150, sortable:true, rowspan:2},
				{ field : 'status_tenant', title : 'Status', width:100, sortable:true, rowspan:2},
			]]
		});
        
/*
        // Setup Form
		$('#form_master').setupForm([
			{ name: 'bulan', type: 'text', size: 'short'},
			{ name: 'tahun', type: 'text', size: 'short'},
		]);

		// Create Dialog
		$('#dialog_container').dialog({
			closed:true,
			modal:true,
			title: 'Pilihan Berdasarkan Tanggal',
			width:400,
			height:200,
			buttons:[{
				text:'Print',
				iconCls:'print',
				handler:function(){
						var bulan = $('#bulan').val();
						var tahun = $('#tahun').val();
						var tanggal = bulan+'-'+tahun;
						window.location = gs_path + '/pro_print_excel/tagihan_sewa_all/?tanggal='+tanggal;
					//$('#form_master').submitForm('/'+controller+'/ajax_post', { onComplete : function(){ $('#dialog_container').dialog('close'); $('#datagrid').datagrid('reload'); }} );
				}
			},{
				text:'Close',
				iconCls:'icon-cancel',
				handler:function(){
					$('#dialog_container').dialog('close');
				}
			}]
		});*/

        // Set Action Button
        var buttons = [ 
                        // ----- >> Edit Button
					    { label: 'Print Semua', icon: 'print', onclick: function() {
					     		window.location = gs_path + '/pro_print_excel_new/calon_penyewa_all/';
					     }},
					   /* { label: 'Print Satuan', icon: 'print', onclick: function() {
								var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								window.location = gs_path + '/pro_print_excel/tagihan_sewa_satuan/?no_tagihan_sewa='+urlencode(oSel.no_tagihan_sewa);
					        } 

					    }},*/

						// ----- >> Download Button
						
						// ----- >> SP Button
					    ];
        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
    });
//--><!]]></script>

    
<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                    <a href="#" class="easyui-linkbutton" iconCls="icon-blank-file" onclick="$('#fm_search').resetForm(); return false;">Reset</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>

